// CherryMerry ( Mikhail Tomilenko ), Reverse Entertainment, 2021-2024

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"

#include <NifestGame/Interfaces/Public/I_Core.h>

#include "PlayerMovementManager.generated.h"


UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class NIFESTGAME_API UPlayerMovementManager : public UActorComponent, public II_Core
{
	GENERATED_BODY()

public:	
	UPlayerMovementManager();

protected:
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
	virtual void BeginPlay() override;

	virtual void UpdateStamina();

	float MaxRunSpeed;
	float MaxWalkSpeed;
	float MaxCrouchedRunSpeed;
	float MaxCrouchedWalkSpeed;

	float CurrentRefillStaminaDelay;
	float CurrentRefillDelayTime;

	float DashDistance;
public:	
	float MaxStamina;
	float CurrentStamina;
	float StaminaDrainTime;
	float StaminaRefillTime;
	float DelayBeforeRefill;

	bool bIsCrouching;
	bool bIsRunning;
	bool bHasStamina;
	bool bBlockingDamage;

	virtual void UseStamina(float AmountToUse);

	virtual void StartSprinting();
	virtual void StopSprinting();

	virtual void StartCrouching();
	virtual void StopCrouching();

	virtual void Dash();
};
